﻿using AllInOne.Classes;
using AllInOne.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace AllInOne
{
    /// <summary>
    /// Manual_ICSettingWindow.xaml 的交互逻辑
    /// </summary>
    public partial class Manual_ICSettingWindow : Window
    {
        public string ICCardSerialPortName { get; set; } = INIHelper.Read("ALL", "ICCardSerialPortName");

        public int ICCardBaudRate { get; set; } = SystemParam.ICCardBaudRate;

        public Manual_ICSettingWindow()
        {
            InitializeComponent();
            DataContext = this;
        }

        private void Ok_OnClick(object sender, RoutedEventArgs e)
        {
            SystemParam.ICCardSerialPortName = ICCardSerialPortName;
            SystemParam.ICCardBaudRate = ICCardBaudRate;

            INIHelper.Write("ALL", "ICCardSerialPortName", ICCardSerialPortName);
            INIHelper.Write("ALL", "ICCardBaudRate", ICCardBaudRate.ToString());

            HandyControl.Controls.Growl.Info("保存成功");
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
            Close();
        }
    }
}
